package io.renren.modules.generator.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.generator.dao.FriendsDao;
import io.renren.modules.generator.entity.FriendsEntity;
import io.renren.modules.generator.service.FriendsService;

import javax.annotation.Resource;


@Service("friendsService")
public class FriendsServiceImpl extends ServiceImpl<FriendsDao, FriendsEntity> implements FriendsService {

    @Resource
    private FriendsDao friendsDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<FriendsEntity> page = this.page(
                new Query<FriendsEntity>().getPage(params),
                new QueryWrapper<FriendsEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<Map<String, Object>> getList(Long id,String username) {

        return friendsDao.getList(id,username);
    }
    @Override
    public List<Map<String, Object>> getList2(Long id,String username) {

        return friendsDao.getList2(id,username);
    }

    @Override
    public List<Map<String, Object>> msgList(Long rid) {
        return friendsDao.msgList(rid);
    }

    @Override
    public int add(Long sid, Long rid, String friMsg) {
        return friendsDao.add(sid,rid,friMsg);
    }

    @Override
    public List<Map<String, Object>> friendListByMobile(String mobile) {
        return friendsDao.friendListByMobile(mobile);
    }

    @Override
    public int updateState(Long sid, Long rid, Long friState) {
        return friendsDao.updateState(sid,rid,friState);
    }

    @Override
    public FriendsEntity findFriByids(Long sid, Long rid) {
        return friendsDao.findFriByids(sid,rid);
    }

    @Override
    public List getReceiverList(Long userId) {
        return friendsDao.getReceiverList(userId);
    }

    @Override
    public List getSenderList(Long userId) {
        return friendsDao.getSenderList(userId);
    }


}